<!--
- File:    文章详细页(后台发布的文章)
-->
<template>
  <div class="pb120 bg_fff">
    <div class="newdetail p20">
      <h4>{{articleInfo.article_title}}</h4>
      <div  class="timesa">{{articleInfo.article_time | timestampToDate('yyyy-MM-dd hh:mm')}}  <span style="float: right" @click="share" v-show="false && $deviceType == 'APICloud'">分享</span></div>
      <div class="cont" v-html="articleInfo.article_content"></div>
    </div>
    <footer-tab></footer-tab>
  </div>
</template>

<script>
  export default{
    data() {
      return {
        articleId: this.$route.params.id,
        articleInfo: {}
      }
    },
    created() {
      this.getNewsDetail()
    },
    methods: {
      share() {
        let _this = this
        var wx = window.api.require('wx')
        wx.shareWebpage({
          apiKey: '',
          scene: 'session',
          title: _this.articleInfo.article_title,
          description: '资讯',
          contentUrl: _this.$config.website + '/wap/news/detail/' + _this.articleId
        }, function(ret, err) {
          if (ret.status) {
            this.$toast('分享成功')
          } else {
            this.$toast('分享失败:' + err.code)
          }
        })
      },
      getNewsDetail() {
        this.$request.getNewsDetail(this.articleId).then(data => {
          this.articleInfo = data
        }).catch(e => {
          this.$toast('获取文章详情失败' + e.msg)
        })
      }
    }
  }
</script>

<style lang="less">
  .article-thumb {
    color: #3dbb6e !important;
  }

  .article-detail {
    padding: 0 10px;
    img {
      width: 100% !important;
      height: auto !important;
    }
  }
</style>